package com.shxc.smarttrade.old.activity;

import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.LinearLayout;

import com.shxc.smarttrade.R;
import com.just.library.AgentWeb;
import com.zhy.autolayout.AutoLinearLayout;

import butterknife.BindView;


/**
 * Created by jcdev1 on 2017/7/10.
 */

public class TestActivity extends BaseActivity {
    private AgentWeb mAgentWeb;
    @BindView(R.id.linear_layout)
    AutoLinearLayout mLinearLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_quick_start);

        Intent intent = getIntent();
        String url = intent.getStringExtra("url");
        mAgentWeb = AgentWeb.with(this)//传入Activity
                .setAgentWebParent(mLinearLayout, new LinearLayout.LayoutParams(-1, -1))//传入AgentWeb 的父控件 ，如果父控件为 RelativeLayout ， 那么第二参数需要传入 RelativeLayout.LayoutParams
                .useDefaultIndicator()// 使用默认进度条
                .defaultProgressBarColor() // 使用默认进度条颜色
//                .setReceivedTitleCallback(mCallback) //setting Web 页面的 title 回调
                .createAgentWeb()//
                .ready()
                .go(url);
        new MyThread().start();
        new Thread(new MyThread2()).start();

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        mAgentWeb.uploadFileResult(requestCode, resultCode, data);
        super.onActivityResult(requestCode, resultCode, data);
    }

    class MyThread extends Thread {
        @Override
        public void run() {
            super.run();
        }
    }

    class MyThread2 implements Runnable {
        @Override
        public void run() {

        }
    }

    class downLoadTask extends AsyncTask<Void, Integer, Boolean> {

        //任务开始前
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
        }

        //任务开始中
        @Override
        protected Boolean doInBackground(Void... params) {
            publishProgress(9);
            return null;
        }

        //接收任务中传递出来的消息
        @Override
        protected void onProgressUpdate(Integer... values) {
            super.onProgressUpdate(values);
        }

        //任务结束
        @Override
        protected void onPostExecute(Boolean aBoolean) {
            super.onPostExecute(aBoolean);
        }
    }

}
